Properties

$dir

$dir : string

Type

string

$url

$url : string

Type

string

$task

$task : string

Type

string

$initialized

$initialized : bool

Type

bool

$output

$output

$handlers

$handlers

$allowed_prefs

$allowed_prefs

$allowed_session_prefs

$allowed_session_prefs

$active_plugins

$active_plugins

$instance

$instance

$plugins

$plugins

$plugins_initialized

$plugins_initialized

$tasks

$tasks

$actions

$actions

$actionmap

$actionmap

$objectsmap

$objectsmap

$template_contents

$template_contents

$exec_stack

$exec_stack

$deprecated_hooks

$deprecated_hooks

Methods

get_instance()

get_instance() : \rcube_plugin_api

This implements the 'singleton' design pattern

Returns

\rcube_plugin_api —

The one and only instance if this class

init()

init(\rcube  $app, string  $task = '') : mixed

Initialize plugin engine

This has to be done after rcmail::load_gui() or rcmail::json_init() was called because plugins need to have access to rcmail->output

Parameters

\rcube $app

Instance of the rcube base class

string $task

Current application task (used for conditional plugin loading)

Returns

mixed —

load_plugins()

load_plugins(array  $plugins_enabled, array  $plugins_required = []) : mixed

Load and init all enabled plugins

This has to be done after rcmail::load_gui() or rcmail::json_init() was called because plugins need to have access to rcmail->output

Parameters

array $plugins_enabled

List of configured plugins to load

array $plugins_required

List of plugins required by the application

Returns

mixed —

load_plugin()

load_plugin(string  $plugin_name, bool  $force = false, bool  $require = true) : bool

Load the specified plugin

Parameters

string $plugin_name

Plugin name

bool $force

Force loading of the plugin even if it doesn't match the filter

bool $require

Require loading of the plugin, error if it doesn't exist

Returns

bool —

True on success, false if not loaded or failure

get_info()

get_info(string  $plugin_name) : array

Get information about a specific plugin.

This is either provided by a plugin's info() method or extracted from a package.xml or a composer.json file

Parameters

string $plugin_name

Plugin name

Returns

array —

Meta information about a plugin or False if plugin was not found

register_hook()

register_hook(string  $hook, callable  $callback) : mixed

Allows a plugin object to register a callback for a certain hook

Parameters

string $hook

Hook name

callable $callback

A callback function

Returns

mixed —

unregister_hook()

unregister_hook(string  $hook, callable  $callback) : mixed

Allow a plugin object to unregister a callback.

Parameters

string $hook

Hook name

callable $callback

A callback function

Returns

mixed —

exec_hook()

exec_hook(string  $hook, array  $args = []) : array

Triggers a plugin hook.

This is called from the application and executes all registered handlers

Parameters

string $hook

Hook name

array $args

Named arguments (key->value pairs)

Returns

array —

The (probably) altered hook arguments

register_action()

register_action(string  $action, string  $owner, callable  $callback, string  $task = null) : mixed

Let a plugin register a handler for a specific request

Parameters

string $action

Action name (_task=mail&_action=plugin.foo)

string $owner

Plugin name that registers this action

callable $callback

A callback function

string $task

Task name registered by this plugin

Returns

mixed —

exec_action()

exec_action(string  $action) : mixed

This method handles requests like _task=mail&_action=plugin.foo It executes the callback function that was registered with the given action.

Parameters

string $action

Action name

Returns

mixed —

register_handler()

register_handler(string  $name, string  $owner, callable  $callback) : mixed

Register a handler function for template objects

Parameters

string $name

Object name

string $owner

Plugin name that registers this action

callable $callback

A callback function

Returns

mixed —

register_task()

register_task(string  $task, string  $owner) : mixed

Register this plugin to be responsible for a specific task

Parameters

string $task

Task name (only characters [a-z0-9_-] are allowed)

string $owner

Plugin name that registers this action

Returns

mixed —

is_plugin_task()

is_plugin_task(string  $task) : bool

Checks whether the given task is registered by a plugin

Parameters

string $task

Task name

Returns

bool —

True if registered, otherwise false

is_processing()

is_processing(string  $hook = null) : bool

Check if a plugin hook is currently processing.

Mainly used to prevent loops and recursion.

Parameters

string $hook

Hook to check (optional)

Returns

bool —

True if any/the given hook is currently processed, otherwise false

include_script()

include_script(string  $fn) : mixed

Include a plugin script file in the current HTML page

Parameters

string $fn

Path to script

Returns

mixed —

include_stylesheet()

include_stylesheet(string  $fn) : mixed

Include a plugin stylesheet in the current HTML page

Parameters

string $fn

Path to stylesheet

Returns

mixed —

add_content()

add_content(string  $html, string  $container) : mixed

Save the given HTML content to be added to a template container

Parameters

string $html

HTML content

string $container

Template container identifier

Returns

mixed —

loaded_plugins()

loaded_plugins() : array

Returns list of loaded plugins names

Returns

array —

List of plugin names

get_plugin()

get_plugin(mixed  $name) : \rcube_plugin|null

Returns loaded plugin

Parameters

mixed $name

Returns

\rcube_plugin|null —

Plugin instance

__construct()

__construct() : mixed

Private constructor

Returns

mixed —

template_container_hook()

template_container_hook(array  $attrib) : array

Callback for template_container hooks

Parameters

array $attrib

Container attributes

Returns

array —

resource_url()

resource_url(string  $fn) : string

Make the given file name link into the plugins directory

Parameters

string $fn

Filename

Returns

string —

filter()

filter(\rcube_plugin  $plugin) : bool

Check if we should prevent this plugin from initializing

Parameters

\rcube_plugin $plugin

Plugin object

Returns

bool —